From 74cb863650b2bb8457531d29245e079350011a90 Mon Sep 17 00:00:00 2001 From: Malte Schwarzkopf Date: Sun, 12 Feb 2017 19:56:41 -0500 Subject: [PATCH] Fix CARGO_INCREMENTAL semantics to be intuitive Previously, the mere presence of a CARGO_INCREMENTAL variable in the environment caused incremental compilation to happen. This has the very unintuitive effect that `CARGO_INCREMENTAL=0` and even `CARGO_INCREMENTAL=` mean incremental compilation is *on*. This change brings the semantics in line with how they are defined in the tests (cf. tests/build.rs:45), and in public-facing documentation (https://internals.rust-lang.org/t/incremental-compilation-beta/4721). --- src/cargo/ops/cargo_rustc/context.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 4ecd6a7e5..31606eb52 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -78,7 +78,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> { // Enable incremental builds if the user opts in. For now, // this is an environment variable until things stabilize a // bit more. - let incremental_enabled = env::var("CARGO_INCREMENTAL").is_ok(); + let incremental_enabled = match env::var("CARGO_INCREMENTAL") { + Ok(v) => v == "1", + Err(_) => false, + }; Ok(Context { ws: ws, -- 2.30.2